#本机编译使用/lib/modules/`uname -r`/build
#KERNELDIR := /lib/modules/`uname -r`/build
#KERNELDIR := /lib/modules/4.15.0-189-generic/build
KERNELDIR := /lib/modules/$(shell uname -r)/build

CURRENT_PATH := $(shell pwd)

CPPFLAGS += -include $(KERNELDIR)/include/generated/autoconf.h
EXTRA_CFLAGS +=-Wno-date-time
EXTRA_CFLAGS +=-Werror=incompatible-pointer-types

#要生成的模块名
obj-m := fpga_drv.o
fpga_drv-objs := fpga_pcie_drv.o drv_dma_all.o drv_dma_chn_rx.o drv_dma_chn_tx.o

build: kernel_modules

kernel_modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
	
clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean


#KERNELDIR ?= /opt/qt9260/linux/linux-2.6.30
#PWD := $(shell pwd)
#obj-m := fpga.o
#fpga-objs := fpga_drv.o fpga_ioctl.o fpga_mmap.o tap_i2c.o 
#modules:
#	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
#modules_install: 
#	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
#clean:
#	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.order *.symvers

